
//!    @file This programme is making overturn of lines
 //!   @author Nikita Berenkov
 //!   @version V1.0
 //!   @date

 //!   @mainpage

#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<ctype.h>
/**
    @brief    There are three functions:

    @code     int swapping(char *a, char *b)

    @brief    This function swaps two char symbols
    @param     a - adress of the first char symbol
            b - adress of the second


    @code     int reverse_stroka(char str[])
    @brief     this function is turning all words in the line over
    @param     str[] -the line


    @code     int reverse_word(char str[], int left, int right)
    @param     str[] - the line
           left - the left border symbol
            right - the right bordeer symbol
*/
int swapping(char *a, char *b);
int reverse_stroka(char str[]);
int reverse_word(char str[], int left, int right);

int main(void)
{
    char s[1000];//<
    int o=0;
    int i;
int  c;
//printf("%c",c);
//c=getchar();
while ((c=getchar())!='\n')

{
    s[o]=c;
    o++;

}
reverse_stroka(s);

}



int swapping(char *a, char *b)
{
    char tmp = *a;
    *a = *b;
    *b = tmp;

}
int reverse_stroka(char str[])
{
    int left = -1;
    for(int i = 0; i < strlen(str); i++)
    {
        if ((left == -1) && isalnum(str[i])) left = i;

        if ((left != -1) && (!(isalnum(str[i])) || (str[i]=='\n')))
        { //printf("%d %d ",left,i-1);
       // printf("\n");
            reverse_word(str, left, i - 1);
                //for (int j=0;j<=i-1;j++)
                //printf("%c",str[j]);
            left = -1;
        }


    }



}


int reverse_word(char str[], int left, int right)
{
    for (int i = 0; i < (right-left)/2; i++)
        swapping(&str[right - i], &str[left + i]);

    for (int j=left;j<=right;j++)
         printf("%c",str[j]);
         printf(" ");

}
